home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Think Class Libraries / TP TCL->CW TCL v1.1.2.3 / UPI ƒ / Updated UPIs ƒ / MacTCP.p < prev    next >
Text File  |  1996-02-07  |  21KB  |  823 lines

  1. {
  2.      File:        MacTCP.p
  3.  
  4.      Contains:    TCP Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacTCP 2.0.6
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT MacTCP;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __MACTCP__}
  30. {$SETC __MACTCP__ := 1}
  31.  
  32. {$I+}
  33. {$SETC MacTCPIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __APPLETALK__}
  43. {$I AppleTalk.p}
  44. {$ENDC}
  45. {    OSUtils.p                                                    }
  46. {        MixedMode.p                                                }
  47. {        Memory.p                                                }
  48.  
  49. {$PUSH}
  50. {$ALIGN MAC68K}
  51. {$LibExport+}
  52. {
  53. Developer Notes:
  54.         0. This MacTCP header replaces what used to be defined in the following header files
  55.             MacTCPCommonTypes.h
  56.             GetMyIPAddr.h
  57.             MiscIPPB.h
  58.             TCPPB.h
  59.             UDPPB.h 
  60.             
  61.             When the various control calls are made to the ip driver, you must set up a 
  62.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  63.             Otherwise, the 68K driver code, will not correctly call your routine.
  64.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  65.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  66.             the ioCompletion parameter.
  67.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  68.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  69.             to pass in the ioCompletion field of the parameter block.
  70.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  71.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  72.             of the parameter block
  73.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  74.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  75.             universal procptr to pass in the ioCompletion field of the paramter
  76.             block.
  77.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  78.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  79.             of the parameter block
  80.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  81.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  82.             universal procptr to pass in the ioCompletion field of the paramter
  83.             block.
  84.         7. For all calls implementing a notifyProc or ioCompletion routine
  85.             which was set up using a NewTCPRoutineProc call, do not call
  86.             DisposeRoutineSDescriptor on the universal procptr until
  87.             after the completion or notify proc has completed.
  88. }
  89. { MacTCP return Codes in the range -23000 through -23049 }
  90.  
  91. CONST
  92.     inProgress                    = 1;                            { I/O in progress }
  93.     ipBadLapErr                    = -23000;                        { bad network configuration }
  94.     ipBadCnfgErr                = -23001;                        { bad IP configuration error }
  95.     ipNoCnfgErr                    = -23002;                        { missing IP or LAP configuration error }
  96.     ipLoadErr                    = -23003;                        { error in MacTCP load }
  97.     ipBadAddr                    = -23004;                        { error in getting address }
  98.     connectionClosing            = -23005;                        { connection is closing }
  99.     invalidLength                = -23006;
  100.     connectionExists            = -23007;                        { request conflicts with existing connection }
  101.     connectionDoesntExist        = -23008;                        { connection does not exist }
  102.     insufficientResources        = -23009;                        { insufficient resources to perform request }
  103.     invalidStreamPtr            = -23010;
  104.     streamAlreadyOpen            = -23011;
  105.     connectionTerminated        = -23012;
  106.     invalidBufPtr                = -23013;
  107.     invalidRDS                    = -23014;
  108.     invalidWDS                    = -23014;
  109.     openFailed                    = -23015;
  110.     commandTimeout                = -23016;
  111.     duplicateSocket                = -23017;
  112.  
  113. { Error codes from internal IP functions }
  114.     ipDontFragErr                = -23032;                        { Packet too large to send w/o fragmenting }
  115.     ipDestDeadErr                = -23033;                        { destination not responding }
  116.     icmpEchoTimeoutErr            = -23035;                        { ICMP echo timed-out }
  117.     ipNoFragMemErr                = -23036;                        { no memory to send fragmented pkt }
  118.     ipRouteErr                    = -23037;                        { can't route packet off-net }
  119.     nameSyntaxErr                = -23041;
  120.     cacheFault                    = -23042;
  121.     noResultProc                = -23043;
  122.     noNameServer                = -23044;
  123.     authNameErr                    = -23045;
  124.     noAnsErr                    = -23046;
  125.     dnrErr                        = -23047;
  126.     outOfMemory                    = -23048;
  127.  
  128.     BYTES_16WORD                = 2;                            { bytes per = 16, bit ip word }
  129.     BYTES_32WORD                = 4;                            { bytes per = 32, bit ip word }
  130.     BYTES_64WORD                = 8;                            { bytes per = 64, bit ip word }
  131.  
  132. { 8-bit quantity }
  133.     
  134. TYPE
  135.     b_8 = UInt8;
  136.  
  137. { 16-bit quantity }
  138.     b_16 = UInt16;
  139.  
  140. { 32-bit quantity }
  141.     b_32 = UInt32;
  142.  
  143. { IP address is 32-bits }
  144.     ip_addr = b_32;
  145.  
  146.     ip_addrbytes = RECORD
  147.         CASE INTEGER OF
  148.         0: (
  149.             addr:                        b_32;
  150.            );
  151.         1: (
  152.             byte:                        PACKED ARRAY [0..3] OF UInt8; {MWERKS Changed back to Uint8 SInt8; (* UInt8 *)}
  153.            );
  154.  
  155.     END;
  156.  
  157.     wdsEntry = RECORD
  158.         length:                    INTEGER;                                { length of buffer }
  159.         ptr:                    Ptr;                                    { pointer to buffer }
  160.     END;
  161.  
  162.     rdsEntry = RECORD
  163.         length:                    INTEGER;                                { length of buffer }
  164.         ptr:                    Ptr;                                    { pointer to buffer }
  165.     END;
  166.  
  167.     BufferPtr = LONGINT;
  168.  
  169.     StreamPtr = LONGINT;
  170.  
  171.  
  172. CONST
  173.     netUnreach                    = 0;
  174.     hostUnreach                    = 1;
  175.     protocolUnreach                = 2;
  176.     portUnreach                    = 3;
  177.     fragReqd                    = 4;
  178.     sourceRouteFailed            = 5;
  179.     timeExceeded                = 6;
  180.     parmProblem                    = 7;
  181.     missingOption                = 8;
  182.     lastICMPMsgType                = 32767;
  183.  
  184.     
  185. TYPE
  186.     ICMPMsgType = INTEGER;
  187.  
  188.     ip_port = b_16;
  189.  
  190.     ICMPReport = RECORD
  191.         streamPtr:                StreamPtr;
  192.         localHost:                ip_addr;
  193.         localPort:                ip_port;
  194.         remoteHost:                ip_addr;
  195.         remotePort:                ip_port;
  196.         reportType:                INTEGER;
  197.         optionalAddlInfo:        INTEGER;
  198.         optionalAddlInfoPtr:    LONGINT;
  199.     END;
  200.  
  201. { csCode to get our IP address }
  202.  
  203. CONST
  204.     ipctlGetAddr                = 15;
  205.  
  206. TYPE
  207.     GetIPIOCompletionUPP = UniversalProcPtr;
  208.  
  209.     GetAddrParamBlock = RECORD
  210.         qLink:                    ^QElem;
  211.         qType:                    INTEGER;
  212.         ioTrap:                    INTEGER;
  213.         ioCmdAddr:                Ptr;
  214.         ioCompletion:            GetIPIOCompletionUPP;
  215.         ioResult:                OSErr;
  216.         ioNamePtr:                StringPtr;
  217.         ioVRefNum:                INTEGER;
  218.         ioCRefNum:                INTEGER;
  219.         csCode:                    INTEGER;                                { standard I/O header }
  220.         ourAddress:                ip_addr;                                { our IP address }
  221.         ourNetMask:                LONGINT;                                { our IP net mask }
  222.     END;
  223.  
  224. {$IFC MWERKS & PROCTYPE}
  225.     GetIPIOCompletionProcPtr = PROCEDURE (VAR iopb: GetAddrParamBlock);
  226. {$ELSEC}
  227.     GetIPIOCompletionProcPtr = ProcPtr;  { PROCEDURE GetIPIOCompletion(VAR iopb: GetAddrParamBlock); }
  228. {$ENDC}
  229.  
  230. { control codes }
  231.  
  232. CONST
  233.     ipctlEchoICMP                = 17;                            { send icmp echo }
  234.     ipctlLAPStats                = 19;                            { get lap stats }
  235.  
  236. TYPE
  237.     IPIOCompletionUPP = UniversalProcPtr;
  238.  
  239.     ICMPParamBlock = RECORD
  240.         qLink:                    ^QElem;
  241.         qType:                    INTEGER;
  242.         ioTrap:                    INTEGER;
  243.         ioCmdAddr:                Ptr;
  244.         ioCompletion:            IPIOCompletionUPP;
  245.         ioResult:                OSErr;
  246.         ioNamePtr:                StringPtr;
  247.         ioVRefNum:                INTEGER;
  248.         ioCRefNum:                INTEGER;
  249.         csCode:                    INTEGER;                                { standard I/O header }
  250.         params:                    ARRAY [0..10] OF INTEGER;
  251.         icmpEchoInfo:            RECORD
  252.                 echoRequestOut:                    LONGINT;                        { time in ticks of when the echo request went out }
  253.                 echoReplyIn:                    LONGINT;                        { time in ticks of when the reply was received }
  254.                 echoedData:                        rdsEntry;                        { data received in responce }
  255.                 options:                        Ptr;
  256.                 userDataPtr:                    LONGINT;
  257.             END;
  258.  
  259.  
  260.     END;
  261.  
  262. {$IFC MWERKS & PROCTYPE}
  263.     IPIOCompletionProcPtr = PROCEDURE (VAR iopb: ICMPParamBlock);
  264. {$ELSEC}
  265.     IPIOCompletionProcPtr = ProcPtr;  { PROCEDURE IPIOCompletion(VAR iopb: ICMPParamBlock); }
  266. {$ENDC}
  267.  
  268.     ICMPEchoNotifyUPP = UniversalProcPtr;
  269.  
  270.     IPParamBlock = RECORD
  271.         qLink:                    ^QElem;
  272.         qType:                    INTEGER;
  273.         ioTrap:                    INTEGER;
  274.         ioCmdAddr:                Ptr;
  275.         ioCompletion:            IPIOCompletionUPP;
  276.         ioResult:                OSErr;
  277.         ioNamePtr:                StringPtr;
  278.         ioVRefNum:                INTEGER;
  279.         ioCRefNum:                INTEGER;
  280.         csCode:                    INTEGER;                                { standard I/O header }
  281.         CASE INTEGER OF
  282.         0: (
  283.             dest:                        ip_addr;                            { echo to IP address }
  284.             data:                        wdsEntry;
  285.             timeout:                    INTEGER;
  286.             options:                    Ptr;
  287.             optLength:                    INTEGER;
  288.             icmpCompletion:                ICMPEchoNotifyUPP;
  289.             userDataPtr:                LONGINT;
  290.            );
  291.         1: (
  292.             lapStatsPtr:                ^LAPStats;
  293.            );
  294.  
  295.     END;
  296.  
  297. {$IFC MWERKS & PROCTYPE}
  298.     ICMPEchoNotifyProcPtr = PROCEDURE (VAR iopb: ICMPParamBlock);
  299. {$ELSEC}
  300.     ICMPEchoNotifyProcPtr = ProcPtr;  { PROCEDURE ICMPEchoNotify(VAR iopb: ICMPParamBlock); }
  301. {$ENDC}
  302.  
  303.     LAPStatsAddrXlation = RECORD
  304.         CASE INTEGER OF
  305.         0: (
  306.             arp_table:                    ^arp_entry;
  307.            );
  308.         1: (
  309.             nbp_table:                    ^nbp_entry;
  310.            );
  311.     END;
  312.  
  313.     LAPStats = RECORD
  314.         ifType:                    INTEGER;
  315.         ifString:                ^CHAR;
  316.         ifMaxMTU:                INTEGER;
  317.         ifSpeed:                LONGINT;
  318.         ifPhyAddrLength:        INTEGER;
  319.         ifPhysicalAddress:        ^CHAR;
  320.         AddrXlation:            LAPStatsAddrXlation;
  321.         slotNumber:                INTEGER;
  322.     END;
  323.  
  324.     nbp_entry = RECORD
  325.         ip_address:                ip_addr;                                { IP address }
  326.         at_address:                AddrBlock;                                { matching AppleTalk address }
  327.         gateway:                BOOLEAN;                                { TRUE if entry for a gateway }
  328.         valid:                    BOOLEAN;                                { TRUE if LAP address is valid }
  329.         probing:                BOOLEAN;                                { TRUE if NBP lookup pending }
  330.         afiller:                SInt8;                                    { Filler for proper byte alignment     }
  331.         age:                    LONGINT;                                { ticks since cache entry verified }
  332.         access:                    LONGINT;                                { ticks since last access }
  333.         filler:                    {MWERKS} PACKED ARRAY [0..115] OF SInt8;{ for internal use only !!! }
  334.     END;
  335.  
  336.     Enet_addr = RECORD
  337.         en_hi:                    b_16;
  338.         en_lo:                    b_32;
  339.     END;
  340.  
  341.     arp_entry = RECORD
  342.         age:                    INTEGER;                                { cache aging field }
  343.         protocol:                b_16;                                    { Protocol type }
  344.         ip_address:                ip_addr;                                { IP address }
  345.         en_address:                Enet_addr;                                { matching Ethernet address }
  346.     END;
  347.  
  348. { number of ARP table entries }
  349.  
  350. CONST
  351.     ARP_TABLE_SIZE                = 20;
  352.  
  353.     NBP_TABLE_SIZE                = 20;                            { number of NBP table entries }
  354.     NBP_MAX_NAME_SIZE            = 16 + 10 + 2;
  355.  
  356. { Command codes }
  357.     TCPCreate                    = 30;
  358.     TCPPassiveOpen                = 31;
  359.     TCPActiveOpen                = 32;
  360.     TCPSend                        = 34;
  361.     TCPNoCopyRcv                = 35;
  362.     TCPRcvBfrReturn                = 36;
  363.     TCPRcv                        = 37;
  364.     TCPClose                    = 38;
  365.     TCPAbort                    = 39;
  366.     TCPStatus                    = 40;
  367.     TCPExtendedStat                = 41;
  368.     TCPRelease                    = 42;
  369.     TCPGlobalInfo                = 43;
  370.     TCPCtlMax                    = 49;
  371.  
  372.     TCPClosing                    = 1;
  373.     TCPULPTimeout                = 2;
  374.     TCPTerminate                = 3;
  375.     TCPDataArrival                = 4;
  376.     TCPUrgent                    = 5;
  377.     TCPICMPReceived                = 6;
  378.     lastEvent                    = 32767;
  379.  
  380.     
  381. TYPE
  382.     TCPEventCode = INTEGER;
  383.  
  384.  
  385. CONST
  386.     TCPRemoteAbort                = 2;
  387.     TCPNetworkFailure            = 3;
  388.     TCPSecPrecMismatch            = 4;
  389.     TCPULPTimeoutTerminate        = 5;
  390.     TCPULPAbort                    = 6;
  391.     TCPULPClose                    = 7;
  392.     TCPServiceError                = 8;
  393.     lastReason                    = 32767;
  394.  
  395.     
  396. TYPE
  397.     TCPTerminationReason = INTEGER;
  398.  
  399. {$IFC MWERKS & PROCTYPE}
  400.     TCPNotifyProcPtr = PROCEDURE (tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport);
  401. {$ELSEC}
  402.     TCPNotifyProcPtr = ProcPtr;  { PROCEDURE TCPNotify(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport); }
  403. {$ENDC}
  404.  
  405.     TCPNotifyUPP = UniversalProcPtr;
  406.  
  407.     tcp_port = INTEGER;
  408.  
  409. { ValidityFlags }
  410.  
  411. CONST
  412.     timeoutValue                = $80;
  413.     timeoutAction                = $40;
  414.     typeOfService                = $20;
  415.     precedence                    = $10;
  416.  
  417. { TOSFlags }
  418.     lowDelay                    = $01;
  419.     throughPut                    = $02;
  420.     reliability                    = $04;
  421.  
  422.  
  423. TYPE
  424.     TCPCreatePB = RECORD
  425.         rcvBuff:                Ptr;
  426.         rcvBuffLen:                LONGINT;
  427.         notifyProc:                TCPNotifyUPP;
  428.         userDataPtr:            Ptr;
  429.     END;
  430.  
  431.     TCPOpenPB = RECORD
  432.         ulpTimeoutValue:        SInt8;
  433.         ulpTimeoutAction:        SInt8;
  434.         validityFlags:            SInt8;
  435.         commandTimeoutValue:    SInt8;
  436.         remoteHost:                ip_addr;
  437.         remotePort:                tcp_port;
  438.         localHost:                ip_addr;
  439.         localPort:                tcp_port;
  440.         tosFlags:                SInt8;
  441.         precedence:                SInt8;
  442.         dontFrag:                BOOLEAN;
  443.         timeToLive:                SInt8;
  444.         security:                SInt8;
  445.         optionCnt:                SInt8;
  446.         options:                {MWERKS} PACKED ARRAY [0..39] OF SInt8;
  447.         userDataPtr:            Ptr;
  448.     END;
  449.  
  450.     TCPSendPB = RECORD
  451.         ulpTimeoutValue:        SInt8;
  452.         ulpTimeoutAction:        SInt8;
  453.         validityFlags:            SInt8;
  454.         pushFlag:                BOOLEAN;
  455.         urgentFlag:                BOOLEAN;
  456.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  457.         wdsPtr:                    Ptr;
  458.         sendFree:                LONGINT;
  459.         sendLength:                INTEGER;
  460.         userDataPtr:            Ptr;
  461.     END;
  462.  
  463. { for receive and return rcv buff calls }
  464. {   Note: the filler in the following structure is in a different location than }
  465. {         that specified in the Programmer's Guide.  }
  466.     TCPReceivePB = RECORD
  467.         commandTimeoutValue:    SInt8;
  468.         markFlag:                BOOLEAN;
  469.         urgentFlag:                BOOLEAN;
  470.         filler:                    SInt8;                                    { Filler for proper byte alignment  }
  471.         rcvBuff:                Ptr;
  472.         rcvBuffLen:                INTEGER;
  473.         rdsPtr:                    Ptr;
  474.         rdsLength:                INTEGER;
  475.         secondTimeStamp:        INTEGER;
  476.         userDataPtr:            Ptr;
  477.     END;
  478.  
  479.     TCPClosePB = RECORD
  480.         ulpTimeoutValue:        SInt8;
  481.         ulpTimeoutAction:        SInt8;
  482.         validityFlags:            SInt8;
  483.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  484.         userDataPtr:            Ptr;
  485.     END;
  486.  
  487.     HistoBucket = RECORD
  488.         value:                    INTEGER;
  489.         counter:                LONGINT;
  490.     END;
  491.  
  492.  
  493. CONST
  494.     NumOfHistoBuckets            = 7;
  495.  
  496.  
  497. TYPE
  498.     TCPConnectionStats = RECORD
  499.         dataPktsRcvd:            LONGINT;
  500.         dataPktsSent:            LONGINT;
  501.         dataPktsResent:            LONGINT;
  502.         bytesRcvd:                LONGINT;
  503.         bytesRcvdDup:            LONGINT;
  504.         bytesRcvdPastWindow:    LONGINT;
  505.         bytesSent:                LONGINT;
  506.         bytesResent:            LONGINT;
  507.         numHistoBuckets:        INTEGER;
  508.         sentSizeHisto:            ARRAY [0..NumOfHistoBuckets-1] OF HistoBucket;
  509.         lastRTT:                INTEGER;
  510.         tmrSRTT:                INTEGER;
  511.         rttVariance:            INTEGER;
  512.         tmrRTO:                    INTEGER;
  513.         sendTries:                SInt8;
  514.         sourchQuenchRcvd:        SInt8;
  515.     END;
  516.  
  517.     TCPStatusPB = RECORD
  518.         ulpTimeoutValue:        SInt8;
  519.         ulpTimeoutAction:        SInt8;
  520.         unused:                    LONGINT;
  521.         remoteHost:                ip_addr;
  522.         remotePort:                tcp_port;
  523.         localHost:                ip_addr;
  524.         localPort:                tcp_port;
  525.         tosFlags:                SInt8;
  526.         precedence:                SInt8;
  527.         connectionState:        SInt8;
  528.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  529.         sendWindow:                INTEGER;
  530.         rcvWindow:                INTEGER;
  531.         amtUnackedData:            INTEGER;
  532.         amtUnreadData:            INTEGER;
  533.         securityLevelPtr:        Ptr;
  534.         sendUnacked:            LONGINT;
  535.         sendNext:                LONGINT;
  536.         congestionWindow:        LONGINT;
  537.         rcvNext:                LONGINT;
  538.         srtt:                    LONGINT;
  539.         lastRTT:                LONGINT;
  540.         sendMaxSegSize:            LONGINT;
  541.         connStatPtr:            ^TCPConnectionStats;
  542.         userDataPtr:            Ptr;
  543.     END;
  544.  
  545.     TCPAbortPB = RECORD
  546.         userDataPtr:            Ptr;
  547.     END;
  548.  
  549.     TCPParam = RECORD
  550.         tcpRtoA:                LONGINT;
  551.         tcpRtoMin:                LONGINT;
  552.         tcpRtoMax:                LONGINT;
  553.         tcpMaxSegSize:            LONGINT;
  554.         tcpMaxConn:                LONGINT;
  555.         tcpMaxWindow:            LONGINT;
  556.     END;
  557.  
  558.     TCPStats = RECORD
  559.         tcpConnAttempts:        LONGINT;
  560.         tcpConnOpened:            LONGINT;
  561.         tcpConnAccepted:        LONGINT;
  562.         tcpConnClosed:            LONGINT;
  563.         tcpConnAborted:            LONGINT;
  564.         tcpOctetsIn:            LONGINT;
  565.         tcpOctetsOut:            LONGINT;
  566.         tcpOctetsInDup:            LONGINT;
  567.         tcpOctetsRetrans:        LONGINT;
  568.         tcpInputPkts:            LONGINT;
  569.         tcpOutputPkts:            LONGINT;
  570.         tcpDupPkts:                LONGINT;
  571.         tcpRetransPkts:            LONGINT;
  572.     END;
  573.  
  574.     StreamPPtr = ^StreamPtr;
  575.  
  576.     TCPGlobalInfoPB = RECORD
  577.         tcpParamPtr:            ^TCPParam;
  578.         tcpStatsPtr:            ^TCPStats;
  579.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  580.         userDataPtr:            Ptr;
  581.         maxTCPConnections:        INTEGER;
  582.     END;
  583.  
  584.     TCPIOCompletionUPP = UniversalProcPtr;
  585.  
  586.     TCPiopb = RECORD
  587.         fill12:                    {MWERKS} PACKED ARRAY [0..11] OF SInt8;
  588.         ioCompletion:            TCPIOCompletionUPP;
  589.         ioResult:                INTEGER;
  590.         ioNamePtr:                Ptr;
  591.         ioVRefNum:                INTEGER;
  592.         ioCRefNum:                INTEGER;
  593.         csCode:                    INTEGER;
  594.         tcpStream:                StreamPtr;
  595.         CASE INTEGER OF
  596.         0: (
  597.             create:                        TCPCreatePB;
  598.            );
  599.         1: (
  600.             open:                        TCPOpenPB;
  601.            );
  602.         2: (
  603.             send:                        TCPSendPB;
  604.            );
  605.         3: (
  606.             receive:                    TCPReceivePB;
  607.            );
  608.         4: (
  609.             close:                        TCPClosePB;
  610.            );
  611.         5: (
  612.             abort:                        TCPAbortPB;
  613.            );
  614.         6: (
  615.             status:                        TCPStatusPB;
  616.            );
  617.         7: (
  618.             globalInfo:                    TCPGlobalInfoPB;
  619.            );
  620.  
  621.     END;
  622.  
  623. {$IFC MWERKS & PROCTYPE}
  624.     TCPIOCompletionProcPtr = PROCEDURE (VAR iopb: TCPiopb);
  625. {$ELSEC}
  626.     TCPIOCompletionProcPtr = ProcPtr;  { PROCEDURE TCPIOCompletion(VAR iopb: TCPiopb); }
  627. {$ENDC}
  628.  
  629. CONST
  630.     UDPCreate                    = 20;
  631.     UDPRead                        = 21;
  632.     UDPBfrReturn                = 22;
  633.     UDPWrite                    = 23;
  634.     UDPRelease                    = 24;
  635.     UDPMaxMTUSize                = 25;
  636.     UDPStatus                    = 26;
  637.     UDPMultiCreate                = 27;
  638.     UDPMultiSend                = 28;
  639.     UDPMultiRead                = 29;
  640.     UDPCtlMax                    = 29;
  641.  
  642.     UDPDataArrival                = 1;
  643.     UDPICMPReceived                = 2;
  644.     lastUDPEvent                = 32767;
  645.  
  646.     
  647. TYPE
  648.     UDPEventCode = INTEGER;
  649.  
  650. {$IFC MWERKS & PROCTYPE}
  651.     UDPNotifyProcPtr = PROCEDURE (udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport);
  652. {$ELSEC}
  653.     UDPNotifyProcPtr = ProcPtr;  { PROCEDURE UDPNotify(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport); }
  654. {$ENDC}
  655.  
  656.     UDPNotifyUPP = UniversalProcPtr;
  657.  
  658.     udp_port = INTEGER;
  659.  
  660. { for create and release calls }
  661.     UDPCreatePB = RECORD
  662.         rcvBuff:                Ptr;
  663.         rcvBuffLen:                LONGINT;
  664.         notifyProc:                UDPNotifyUPP;
  665.         localPort:                INTEGER;
  666.         userDataPtr:            Ptr;
  667.         endingPort:                udp_port;
  668.     END;
  669.  
  670.     UDPSendPB = RECORD
  671.         reserved:                INTEGER;
  672.         remoteHost:                ip_addr;
  673.         remotePort:                udp_port;
  674.         wdsPtr:                    Ptr;
  675.         checkSum:                BOOLEAN;
  676.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  677.         sendLength:                INTEGER;
  678.         userDataPtr:            Ptr;
  679.         localPort:                udp_port;
  680.     END;
  681.  
  682. { for receive and buffer return calls }
  683.     UDPReceivePB = RECORD
  684.         timeOut:                INTEGER;
  685.         remoteHost:                ip_addr;
  686.         remotePort:                udp_port;
  687.         rcvBuff:                Ptr;
  688.         rcvBuffLen:                INTEGER;
  689.         secondTimeStamp:        INTEGER;
  690.         userDataPtr:            Ptr;
  691.         destHost:                ip_addr;                                { only for use with multi rcv }
  692.         destPort:                udp_port;                                { only for use with multi rcv }
  693.     END;
  694.  
  695.     UDPMTUPB = RECORD
  696.         mtuSize:                INTEGER;
  697.         remoteHost:                ip_addr;
  698.         userDataPtr:            Ptr;
  699.     END;
  700.  
  701.     UDPIOCompletionUPP = UniversalProcPtr;
  702.  
  703.     UDPiopb = RECORD
  704.         fill12:                    {MWERKS} PACKED ARRAY [0..11] OF SInt8;
  705.         ioCompletion:            UDPIOCompletionUPP;
  706.         ioResult:                INTEGER;
  707.         ioNamePtr:                Ptr;
  708.         ioVRefNum:                INTEGER;
  709.         ioCRefNum:                INTEGER;
  710.         csCode:                    INTEGER;
  711.         udpStream:                StreamPtr;
  712.         CASE INTEGER OF
  713.         0: (
  714.             create:                        UDPCreatePB;
  715.            );
  716.         1: (
  717.             send:                        UDPSendPB;
  718.            );
  719.         2: (
  720.             receive:                    UDPReceivePB;
  721.            );
  722.         3: (
  723.             mtu:                        UDPMTUPB;
  724.            );
  725.  
  726.     END;
  727.  
  728. {$IFC MWERKS & PROCTYPE}
  729.     UDPIOCompletionProcPtr = PROCEDURE (VAR iopb: UDPiopb);
  730. {$ELSEC}
  731.     UDPIOCompletionProcPtr = ProcPtr;  { PROCEDURE UDPIOCompletion(VAR iopb: UDPiopb); }
  732. {$ENDC}
  733.  
  734. CONST
  735.     uppGetIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  736.     uppIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  737.     uppICMPEchoNotifyProcInfo = $000000C0; { PROCEDURE (4 byte param); }
  738.     uppTCPNotifyProcInfo = $0000EEC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 2 byte param, 4 byte param); }
  739.     uppTCPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  740.     uppUDPNotifyProcInfo = $00003EC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 4 byte param); }
  741.     uppUDPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  742.  
  743. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  744.     {$IFC NOT GENERATINGCFM }
  745.     INLINE $2E9F;
  746.     {$ENDC}
  747.  
  748. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  749.     {$IFC NOT GENERATINGCFM }
  750.     INLINE $2E9F;
  751.     {$ENDC}
  752.  
  753. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  754.     {$IFC NOT GENERATINGCFM }
  755.     INLINE $2E9F;
  756.     {$ENDC}
  757.  
  758. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  759.     {$IFC NOT GENERATINGCFM }
  760.     INLINE $2E9F;
  761.     {$ENDC}
  762.  
  763. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  764.     {$IFC NOT GENERATINGCFM }
  765.     INLINE $2E9F;
  766.     {$ENDC}
  767.  
  768. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  769.     {$IFC NOT GENERATINGCFM }
  770.     INLINE $2E9F;
  771.     {$ENDC}
  772.  
  773. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  774.     {$IFC NOT GENERATINGCFM }
  775.     INLINE $2E9F;
  776.     {$ENDC}
  777.  
  778. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  779.     {$IFC NOT GENERATINGCFM}
  780.     INLINE $205F, $4E90;
  781.     {$ENDC}
  782.  
  783. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  784.     {$IFC NOT GENERATINGCFM}
  785.     INLINE $205F, $4E90;
  786.     {$ENDC}
  787.  
  788. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  789.     {$IFC NOT GENERATINGCFM}
  790.     INLINE $205F, $4E90;
  791.     {$ENDC}
  792.  
  793. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  794.     {$IFC NOT GENERATINGCFM}
  795.     INLINE $205F, $4E90;
  796.     {$ENDC}
  797.  
  798. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  799.     {$IFC NOT GENERATINGCFM}
  800.     INLINE $205F, $4E90;
  801.     {$ENDC}
  802.  
  803. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  804.     {$IFC NOT GENERATINGCFM}
  805.     INLINE $205F, $4E90;
  806.     {$ENDC}
  807.  
  808. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  809.     {$IFC NOT GENERATINGCFM}
  810.     INLINE $205F, $4E90;
  811.     {$ENDC}
  812.  
  813. {$ALIGN RESET}
  814. {$POP}
  815.  
  816. {$SETC UsingIncludes := MacTCPIncludes}
  817.  
  818. {$ENDC} {__MACTCP__}
  819.  
  820. {$IFC NOT UsingIncludes}
  821.  END.
  822. {$ENDC}
  823.